﻿using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using System.Data;
using BEGDC.Utility.NHibernate;
using Castle.Services.Transaction;
using System.Collections;
using System.Xml;
using Castle.Facilities.NHibernateIntegration;

namespace BEGDC.PreContract.BLL
{
	public partial class CATAssignment: ICATAssignment
	{
        //Edwin.fan 2008-9-23
        //Get the province with the max ProvinceId
        public DataTable GetCATAssignmentActive(string employeeID)
        {
            using (ISession session = factory.OpenSession())
            {
                string strSql =String.Format("SELECT a.* FROM CATAssignment as a INNER JOIN CAT as b ON a.CATID = b.CATID where a.EmployeeID = {0}",employeeID);

                DataTable dtSearch = DAO.ExecuteDataTable(session, strSql);

                return dtSearch;
            }

        }

        //Edwin.fan 2008-9-24
        //Delete all assignment by EmployeeID
        public int DeleteAllAssignment(string employeeID)
        {
            using (ISession session = factory.OpenSession())
            {
                string strSql = String.Format("DELETE FROM CATAssignment WHERE EmployeeID = {0}", employeeID);

                return DAO.ExecuteNonQuery(session, strSql);
            }

        }
	}
}



